<?php
error_reporting(0);
$isadmin=1;
include_once '../comm/config.php';
include_once '../comm/func.php';
include_once 'check.php';

function check_addslashes($content){
	if(get_magic_quotes_gpc()==0){
	    $content = addslashes($content);
	}
	return $content;
}

function update_sql($table,$field_arr,$where,$xs,$alert=0){ //$xs 0表示更新 1表示同加  2表示同减,$alert默认为0,1表示打印sql语句,2表示先执行在打印
    global $BIAOTOU;
	$sql="";
	foreach($field_arr as $k=>$v){
		if($xs==0){
		    $sql="`$k`='$v',".$sql;
		}
		elseif($xs==1){
		    $sql="`$k`=`$k`+'$v',".$sql;
		}
		elseif($xs==2){
		    $sql="`$k`=`$k`-'$v',".$sql;
		}
	}
	$sql=substr($sql,0,strlen($sql)-1);
	$sql="update $BIAOTOU$table set $sql where $where;";
	if($alert==0){
		mysql_query($sql);
	}
	elseif($alert==1){
		echo $sql;
	}
	elseif($alert==2){
		mysql_query($sql);
	    echo $sql; 
	}
}

//请不要随意修改代码，凡是随意修改代码造成的一切后果均由修改者本人承担，多多不再提供技术支持
$_POST['Submit']='asdasgg3454575asdasdasd';
$_POST['tongji']=check_addslashes($_POST['tongji']);
$_POST['fxbl']=$_POST['fxbl']/100;
$_POST['fxbl2']=$_POST['fxbl2']/100;
$_POST['fxbl3']=$_POST['fxbl3']/100;
$_POST['fxbl4']=$_POST['fxbl4']/100;
$_POST['mallfxbl1']=$_POST['mallfxbl1']/100;
$_POST['mallfxbl2']=$_POST['mallfxbl2']/100;
$_POST['mallfxbl3']=$_POST['mallfxbl3']/100;
$_POST['mallfxbl4']=$_POST['mallfxbl4']/100;
$_POST['tgbl']=$_POST['tgbl']/100;
$_POST['jifenbl']=$_POST['jifenbl']/100;
$field_arr=array_diff($_POST,array('Submit'=>'asdasgg3454575asdasdasd'));
update_sql('websetting',$field_arr,'Id=1',0,0);

admin_log('保存网站基本设置');

mysql_close();
?>
<script language=javascript>
alert('网站信息更新成功！即将跳转到基本信息设置...');window.location='webset.php'
</script>